!function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;L(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:I(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),m}},t}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function s(e){o(a,i,r,s,c,"next",e)}function c(e){o(a,i,r,s,c,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,n){return t&&function(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var v=Array.isArray,h=Object.prototype,m=h.hasOwnProperty,_=h.toString,y=v||function(e){return"[object Array]"===_.call(e)},w=function(e){return"function"==typeof e},b=function(e){return e===Object(e)&&!y(e)},S=function(e){return void 0===e},E=function(e){return"[object String]"==_.call(e)},x=function(e){return null===e},k=function(e){return S(e)||x(e)},P=function(e){return"[object Boolean]"===_.call(e)},O=function(e){return e instanceof FormData},T="1.0.0",D={DEBUG:window.location.search.includes("dbg=true")||document.cookie.includes("en_dbg"),LIB_VERSION:T},L="undefined"!=typeof window?window:void 0,C="undefined"!=typeof globalThis?globalThis:L,I=Array.prototype,A=I.forEach,N=I.indexOf,M=null==C?void 0:C.navigator,R=null==C?void 0:C.document,j=null==C?void 0:C.location,z=null==C?void 0:C.fetch,H=null!=C&&C.XMLHttpRequest&&"withCredentials"in new C.XMLHttpRequest?C.XMLHttpRequest:void 0,$=null==C?void 0:C.AbortController,B=null==M?void 0:M.userAgent,F=null!=L?L:{},W=Math.random().toString(36).slice(2,10),q="[EntailInsights.js](".concat(W,")"),U={_log:function(e){if(L&&(D.DEBUG||F.ENTAIL_INSIGHTS_DEBUG)&&!S(L.console)&&L.console){for(var t=("__rrweb_original__"in L.console[e]?L.console[e].__rrweb_original__:L.console[e]),n=arguments.length,i=new Array(n>1?n-1:0),r=1;r1?t-1:0),i=1;i0&&(t[n]=e)})),t};function ee(e,t){return n=e,i=function(e){return E(e)&&!x(t)?e.slice(0,t):e},r=new Set,function e(t,n){return t!==Object(t)?i?i(t,n):t:r.has(t)?void 0:(r.add(t),y(t)?(o=[],Y(t,(function(t){o.push(e(t))}))):(o={},J(t,(function(t,n){r.has(t)||(o[n]=e(t,n))}))),o);var o}(n);var n,i,r}var te=function(e){var t,n,i,r,o="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,r=0;r127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),x(s)||(n>t&&(o+=e.substring(t,n)),o+=s,t=n=r+1)}return n>t&&(o+=e.substring(t,e.length)),o},ne=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,n,i,r,o){if(t)if(t.addEventListener&&!r)t.addEventListener(n,i,!!o);else{var a="on"+n,s=t[a];t[a]=function(t,n,i){return function(r){if(r=r||e(null==L?void 0:L.event)){var o,a=!0;w(i)&&(o=i(r));var s=n.call(t,r);return!1!==o&&!1!==s||(a=!1),a}}}(t,i,s)}else U.error("No valid element provided to register_event")}}();var ie=/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/i,re=function(){return!!function(){if(document.getElementsByTagName("article").length>0)return U.info("[article_detector.ts]: isArticlePage: containsArticle: Article tag found"),!0;for(var e=document.getElementsByTagName("div"),t=0;t1e3&&(n.match(/\n/g)||[]).length>5)return U.info("[article_detector.ts]: isArticlePage: containsArticle: Text longer than 1000 characters found and more than 5 paragraphs"),!0}return U.info("[article_detector.ts]: isArticlePage: containsArticle: FALSE"),!1}()||(!!function(){var e=window.location.href;if([/\/blog\//i,/\/article\//i,/\/posts\//i].some((function(t){return t.test(e)})))return U.info("[article_detector.ts]: isArticlePage: detectArticleByURLAndMetadata: URL contains /blog/, /article/, or /posts/"),!0;for(var t=document.getElementsByTagName("meta"),n=0;n0&&(i+=(e.innerText||"").length)})),!!(t-i>5e3?(U.info("[article_detector.ts]: isArticlePage: detectArticleByContentDensity: High text density detected, likely an article or blog post."),1):document.querySelectorAll("h1, h2, h3, h4, h5, h6").length>3?(U.info("[article_detector.ts]: isArticlePage: detectArticleByContentDensity: More than 3 headings found."),1):(U.info("[article_detector.ts]: isArticlePage: detectArticleByContentDensity: FALSE"),0)))));var e,t,n,i},oe="en_sid",ae="en_sid_t",se="en_did",ce="en_lp",le="$enabled_feature_flags",ue="__timers",de="$initial_campaign_params",pe="$initial_referrer_info",fe="$widgets_disabled_server_side",ge="$popups_disabled_server_side",ve="$autocapture_disabled_server_side",he=[ue,oe,le,de,pe],me=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",t=(new Date).getTime();return e.replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},_e=function(){return c((function e(i){var r=this;s(this,e),l(this,"_isDisabledServerSide",null),l(this,"_initialized",!1),l(this,"widgets",[]),l(this,"widgetsContent",[]),l(this,"observedContainers",new Set),l(this,"_injectWidgets",(function(){r.widgets.map((function(e,t){var n=e.element.getAttribute("widget-state"),i=e.element.querySelector("[id^='container']");if(U.info("[widgets.ts]: _injectWidgets: initialized, ".concat(e.initialized," widgetState=").concat(n,", childContainer=").concat(i),e.id),n&&i)U.info("[widgets.ts]: _injectWidgets: already done",e.id);else{var o=r.widgetsContent[(null==e?void 0:e.containerId)||e.id].html;if(o&&e.element){if(U.info("[widgets.ts]: _injectWidgets: init",e.id,e.containerId),r.widgets[t].initialized=!0,U.info("[widgets.ts]: _injectWidgets: set attribute widget-state:done"),e.element.setAttribute("widget-state","done"),o.includes('')){var a,s,c,l=document.createElement("iframe");l.id="container-".concat(e.id),l.style.display="flex",l.style.border="none",l.style.width="100%",l.style.whiteSpace="normal",l.className="widget-wrapper",l.setAttribute("widget-type","form"),l.setAttribute("widget-hydrated","false"),e.element.appendChild(l);var u=function(){var e,t=l.contentDocument||(null==l||null===(e=l.contentWindow)||void 0===e?void 0:e.document);null!=t&&t.body&&(l.style.height=t.body.scrollHeight+"px")};return l.addEventListener("load",u),null==l||null===(a=l.contentWindow)||void 0===a||a.document.open(),null==l||null===(s=l.contentWindow)||void 0===s||s.document.write(o),null==l||null===(c=l.contentWindow)||void 0===c||c.document.close(),void u()}var d=document.createElement("div");d.id="container-".concat(e.id),d.style.display="flex",d.style.whiteSpace="normal",d.className="widget-wrapper",d.setAttribute("widget-type","form"),d.setAttribute("widget-hydrated","false"),e.element.appendChild(d);var p=document.createRange().createContextualFragment(o),f=d.attachShadow({mode:"open"});f.innerHTML="",f.appendChild(p)}}}))})),l(this,"_fetchWidgetHTML",a(n().mark((function e(){var i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.info("[widgets.ts]: _fetchWidgetHTML"),0!==(i=r.widgets.filter((function(e){var t,n,i,o,a,s;return U.info("[widgets.ts]: _fetchWidgetHTML: filter",r.widgetsContent[e.containerId||e.id],!(null!==(t=r.widgetsContent[e.containerId||e.id])&&void 0!==t&&t.inProgress||null!==(n=r.widgetsContent[e.containerId||e.id])&&void 0!==n&&n.errorLoadingWidget||null!==(i=r.widgetsContent[e.containerId||e.id])&&void 0!==i&&i.html)),!(null!==(o=r.widgetsContent[e.containerId||e.id])&&void 0!==o&&o.inProgress||null!==(a=r.widgetsContent[e.containerId||e.id])&&void 0!==a&&a.errorLoadingWidget||null!==(s=r.widgetsContent[e.containerId||e.id])&&void 0!==s&&s.html)})).map((function(e){return r.widgetsContent[e.containerId||e.id]={widgetId:e.id,inProgress:!0,errorLoadingWidget:!1,html:null},{id:e.id,containerId:e.containerId}}))).length){e.next=5;break}return r._injectWidgets(),e.abrupt("return");case 5:U.info("[widgets.ts]: _fetchWidgetHTML: all widgets content",r.widgetsContent),U.info("[widgets.ts]: _fetchWidgetHTML: all widgets",r.widgets),U.info("[widgets.ts]: _fetchWidgetHTML: fetching",i),i.map(function(){var e=a(n().mark((function e(o,a){var s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,U.info("%c[widgets.ts]: Fetching widget: _fetchWidgetHTML: widget id ".concat(o.id," container ").concat(o.containerId," - ").concat(a+1,"/").concat(i.length+1),"background: #222; color: #629df5"),e.next=4,fetch("".concat(r.instance.config.widgets_api_host,"/widget/").concat(o.id,"?url=").concat(encodeURIComponent(window.location.href),"&container=").concat(o.containerId),{method:"GET",headers:{"X-Access-Token":r.instance.config.token}});case 4:return s=e.sent,e.next=7,s.json();case 7:c=e.sent,U.info("[widgets.ts]: _fetchWidgetHTML: fetched widget id ".concat(o.id," container ").concat(o.containerId," - ").concat(a+1,"/").concat(i.length+1)),r.widgetsContent[o.containerId||o.id]=t(t({},r.widgetsContent[o.containerId||o.id]),{},{inProgress:!1,html:c.html}),U.info("[widgets.ts]: _fetchWidgetHTML: after fetching - widgets content",r.widgetsContent),r._injectWidgets(),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),r.widgetsContent[o.containerId||o.id]=t(t({},r.widgetsContent[o.containerId||o.id]),{},{errorLoadingWidget:!0,inProgress:!1}),U.info("[widgets.ts]: _fetchWidgetHTML: fetched error",e.t0,o.id,o.containerId);case 18:case"end":return e.stop()}}),e,null,[[0,14]])})));return function(t,n){return e.apply(this,arguments)}}());case 9:case"end":return e.stop()}}),e)})))),l(this,"_downloadWidget",(function(e,t){U.info("[widgets.ts]: _downloadWidget");var n=e.getAttribute("class").match(/entail-ai-widget-([\w\d]+)/gm)[0].replace("entail-ai-widget-",""),i=e.getAttribute("entail-container-id")||null;if(U.info("[widgets.ts]: _downloadWidget: download widget ".concat(n,", container ").concat(i," - ").concat(t)),"true"!=e.getAttribute("widget-inline-html"))if(e.getAttribute("widget-auto-id"))U.info("[widgets.ts]: _downloadWidget: auto widget - initialization in progress");else if("auto"===n&&(n="auto-".concat(me("xxxxx")),e.setAttribute("widget-auto-id",n)),r.widgets.find((function(t){return t.id===n&&t.element===e&&t.containerId===i}))){if(!e.getAttribute("widget-state")||!e.querySelector("[id^='container']"))return U.info("[widgets.ts]: _downloadWidget: re-injecting widget ".concat(n)),void r._injectWidgets();U.info("[widgets.ts]: _downloadWidget: widget ".concat(n," exist"))}else e.setAttribute("widget-state","render"),r.widgets.push({id:n,containerId:i,element:e,initialized:!1}),U.info("[widgets.ts]: _downloadWidget: adding widget ".concat(n," in container ").concat(i," to download queue")),r._fetchWidgetHTML();else U.info("[widgets.ts]: _downloadWidget: inline injected widget - skipping initialization")})),l(this,"_initWidgets",function(){var e=a(n().mark((function e(t){var i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&"function"==typeof t.querySelectorAll){e.next=2;break}return e.abrupt("return");case 2:if(0!==(i=t.querySelectorAll('div[class*="entail-ai-widget-"]')).length){e.next=6;break}return U.info("[widgets.ts]: observer triggered _initWidgets widget containers - 0"),e.abrupt("return");case 6:i.forEach((function(e,t){U.info("[widgets.ts]: download widget ".concat(t+1," of ").concat(i.length)),r._downloadWidget(e,t)}));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),l(this,"_addObserverIfDesiredNodeAvailable",(function(e){var t=document.getElementsByTagName("body")[0];if(!t)return U.info("[widgets.ts]: failed start observing - node not ready ".concat(t)),void window.setTimeout((function(){return r._addObserverIfDesiredNodeAvailable(e)}),500);U.info("[widgets.ts]: start observing ".concat(t));e.observe(t,{childList:!0,subtree:!0,characterData:!0})})),l(this,"_observe",(function(){U.info("[widgets.ts]: observe");var e=new MutationObserver((function(e){e.forEach((function(e){var t=e.target;r._lazyObserve(t)}))}));r._addObserverIfDesiredNodeAvailable(e)})),l(this,"_lazyObserve",(function(e){if(U.info("[widgets.ts]: _lazyObserve"),e&&"function"==typeof e.querySelectorAll){var t=document.getElementsByTagName("body")[0];if(!t)return U.info("[widgets.ts]: _lazyObserve: failed start observing - node not ready ".concat(t)),void window.setTimeout((function(){return r._lazyObserve(e)}),500);var n=e.querySelectorAll('div[class*="entail-ai-widget-"]');U.info("[widgets.ts]: _lazyObserve: target widgetDivs",n),0!==n.length?(U.info("[widgets.ts]: _lazyObserve: ".concat(n.length," available widgets to be lazy observed")),n.forEach((function(e){r.observedContainers.has(e)?U.info("[widgets.ts]: _lazyObserve: lazy observer already observed"):(U.info("[widgets.ts]: _lazyObserve: lazy observer observe",e),r.observedContainers.add(e),r.lazyObserver.observe(e))}))):U.info("[widgets.ts]: _lazyObserve: could not find any widgets to lazy observe")}})),l(this,"_initialize",a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info("[widgets.ts]: initialize"),r._observe(),r._observeHistory(),r._detectArticlePage();case 4:case"end":return e.stop()}}),e)})))),this.instance=i,this.lazyObserver=new IntersectionObserver((function(e,t){e.forEach((function(e){if(e.isIntersecting){var n=e.target;r._downloadWidget(n,0),U.info("[widgets.ts]: lazyObserver load",n),t.unobserve(n)}}))}),{rootMargin:this.instance.config.lazyload?"300px":"5000px",threshold:0})}),[{key:"_detectArticlePage",value:function(){try{var e=re();e&&U.info("[widgets.ts]: _detectArticlePage: isArticlePage",e)}catch(e){U.info("[widgets.ts]: _detectArticlePage: error",e)}}},{key:"_observeHistory",value:function(){var e=this;window.addEventListener("entail_on_locationchange",(function(){U.info("[widgets.ts]: _observeHistory: URL changed!",window.location.href),e._detectArticlePage(),e.widgetsContent=e.widgetsContent.splice(0,e.widgets.length),e.widgets.splice(0,e.widgets.length),e.observedContainers=new Set,U.info("[widgets.ts]: _observeHistory: reset lists:",e.widgets,e.widgetsContent)}))}},{key:"isEnabled",get:function(){var e,t,n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[fe],i=this._isDisabledServerSide;if(x(i)&&!P(n)&&!this.instance.config.disable_decide)return U.info("[widgets.ts]: isEnabled: false - decide not yet called"),!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n,o=!this.instance.config.widgets;return U.info("[widgets.ts]: isEnabled disabledClient=".concat(o,", disabledServer=").concat(r,"- ").concat(!o&&!r)),!o&&!r}},{key:"startIfEnabled",value:function(){U.info("[widgets.ts]: Starting Widgets Factory"),this.isEnabled&&!this._initialized&&(U.info("[widgets.ts]: Initializing Widgets"),this._initialize(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(e){this.instance.persistence&&this.instance.persistence.register(l({},fe,!!e.widgets_opt_out)),this._isDisabledServerSide=!!e.widgets_opt_out,this.startIfEnabled()}}])}();function ye(e){return e?G(e).split(/\s+/):[]}function we(e){var t="";switch(r(e.className)){case"string":t=e.className;break;case"object":t=("baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ye(t)}function be(e){var t="";return De(e)&&!Le(e)&&e.childNodes&&e.childNodes.length&&J(e.childNodes,(function(e){var n,i;xe(e)&&e.textContent&&(t+=null!==(i=e.textContent,n=k(i)?null:G(i).split(/(\s+)/).filter((function(e){return je(e)})).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))&&void 0!==n?n:"")})),G(t)}function Se(e){return!!e&&1===e.nodeType}function Ee(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function xe(e){return!!e&&3===e.nodeType}function ke(e){return!!e&&11===e.nodeType}var Pe=["a","button","form","input","select","textarea","label"];function Oe(e){var t=e.parentNode;return!(!t||!Se(t))&&t}function Te(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(U.info("shouldCaptureDomEvent"),!L||!e||Ee(e,"html")||!Se(e))return U.info("shouldCaptureDomEvent",!1),!1;if(null!=n&&n.url_allowlist){var o=L.location.href,a=n.url_allowlist;if(a&&!a.some((function(e){return o.match(e)})))return U.info("shouldCaptureDomEvent",!1),!1}if(null!=n&&n.dom_event_allowlist){var s=n.dom_event_allowlist;if(s&&!s.some((function(e){return t.type===e})))return U.info("shouldCaptureDomEvent",!1),!1}for(var c=!1,l=[e],u=!0,d=e;d.parentNode&&!Ee(d,"body");)if(ke(d.parentNode))l.push(d.parentNode.host),d=d.parentNode.host;else{if(!(u=Oe(d)))break;if(i||Pe.indexOf(u.tagName.toLowerCase())>-1)c=!0;else{var p=L.getComputedStyle(u);p&&"pointer"===p.getPropertyValue("cursor")&&(c=!0)}l.push(u),d=u}if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(S(n))return!0;var i,r=g(e);try{var o,a=function(){var e=i.value;if(n.some((function(t){return e.tagName.toLowerCase()===t})))return{v:!0}};for(r.s();!(i=r.n()).done;)if(o=a())return o.v}catch(e){r.e(e)}finally{r.f()}return!1}(l,n))return U.info("shouldCaptureDomEvent",!1),!1;if(!function(e,t){var n=null==t?void 0:t.css_selector_allowlist;if(S(n))return!0;var i,r=g(e);try{var o,a=function(){var e=i.value;if(n.some((function(t){return e.matches(t)})))return{v:!0}};for(r.s();!(i=r.n()).done;)if(o=a())return o.v}catch(e){r.e(e)}finally{r.f()}return!1}(l,n))return U.info("shouldCaptureDomEvent",!1),!1;var f=L.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return U.info("shouldCaptureDomEvent",!0),!0;var v=e.tagName.toLowerCase();switch(v){case"html":return U.info("shouldCaptureDomEvent",!1),!1;case"form":var h=(r||["submit"]).indexOf(t.type)>=0;return U.info("shouldCaptureDomEvent",h),h;case"input":case"select":case"textarea":var m=(r||["change","click"]).indexOf(t.type)>=0;return U.info("shouldCaptureDomEvent",m),m;default:if(c){var _=(r||["click"]).indexOf(t.type)>=0;return U.info("shouldCaptureDomEvent",_),_}var y=(r||["click"]).indexOf(t.type)>=0&&(Pe.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"));return U.info("shouldCaptureDomEvent",y),y}}function De(e){for(var t=e;t.parentNode&&!Ee(t,"body");t=t.parentNode){var n=we(t);if(K(n,"ph-sensitive")||K(n,"ph-no-capture"))return!1}if(K(we(e),"ph-include"))return!0;var i=e.type||"";if(E(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";if(E(r)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Le(e){return!!(Ee(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ee(e,"select")||Ee(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Ce="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Ie=new RegExp("^(?:".concat(Ce,")$")),Ae=new RegExp(Ce),Ne="\\d{3}-?\\d{2}-?\\d{4}",Me=new RegExp("^(".concat(Ne,")$")),Re=new RegExp("(".concat(Ne,")"));function je(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(k(e))return!1;if(E(e)){if(e=G(e),(t?Ie:Ae).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Me:Re).test(e))return!1}return!0}function ze(e){var t=be(e);return je(t="".concat(t," ").concat(He(e)).trim())?t:""}function He(e){var t="";return e&&e.childNodes&&e.childNodes.length&&J(e.childNodes,(function(e){var n;if(e&&"span"===(null===(n=e.tagName)||void 0===n?void 0:n.toLowerCase()))try{var i=be(e);t="".concat(t," ").concat(i).trim(),e.childNodes&&e.childNodes.length&&(t="".concat(t," ").concat(He(e)).trim())}catch(e){U.error(e)}})),t}function $e(e){return function(e){var n=e.map((function(e){var n,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class){e.attr_class.sort();var o,a=g(e.attr_class);try{for(a.s();!(o=a.n()).done;){var s=o.value;r+=".".concat(s.replace(/"/g,""))}}catch(e){a.e(e)}finally{a.f()}}var c=t(t(t(t({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(n=e.nth_child)&&void 0!==n?n:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),l={};return Z(c).sort((function(e,t){var n=u(e,1)[0],i=u(t,1)[0];return n.localeCompare(i)})).forEach((function(e){var t=u(e,2),n=t[0],i=t[1];return l[Be(n.toString())]=Be(i.toString())})),r+=":",r+=Z(c).map((function(e){var t=u(e,2),n=t[0],i=t[1];return"".concat(n,'="').concat(i,'"')})).join("")}));return n.join(";")}(function(e){return e.map((function(e){var t,n,i={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(n=e.attr__href)||void 0===n?void 0:n.slice(0,2048),attr_class:Fe(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Z(e).filter((function(e){return 0===u(e,1)[0].indexOf("attr__")})).forEach((function(e){var t=u(e,2),n=t[0],r=t[1];return i.attributes[n]=r})),i}))}(e))}function Be(e){return e.replace(/"|\\"/g,'\\"')}function Fe(e){var t=e.attr__class;return t?y(t)?t:ye(t):void 0}var We=function(){return c((function e(){s(this,e),this.clicks=[]}),[{key:"isRageClick",value:function(e,t,n){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<30&&n-i.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}])}();function qe(e,t){return t.length>e?t.slice(0,e)+"...":t}var Ue=function(){return c((function e(t){s(this,e),l(this,"_isDisabledServerSide",null),l(this,"_initialized",!1),l(this,"rageclicks",new We),l(this,"_elementsChainAsString",!1),l(this,"_isCalendlyEvent",(function(e){return e.data.event&&0===e.data.event.indexOf("calendly")})),l(this,"_isHubspotEvent",(function(e){var t,n,i;return(null==e?void 0:e.origin.includes("hubspot.com"))&&(null==e?void 0:e.origin.includes("meetings"))||(null==e||null===(t=e.data)||void 0===t?void 0:t.forwarded)&&(null==e||null===(n=e.data)||void 0===n||null===(n=n.forwardedOrigin)||void 0===n?void 0:n.includes("hubspot.com"))&&(null==e||null===(i=e.data)||void 0===i||null===(i=i.forwardedOrigin)||void 0===i?void 0:i.includes("meetings"))})),this.instance=t}),[{key:"config",get:function(){return b(this.instance.config.autocapture)?this.instance.config.autocapture:{}}},{key:"_trackScheduleMeeting",value:function(){var e=this;if(L&&R){L.addEventListener("message",(function(t){var n;if(e._isCalendlyEvent(t))switch(U.info("[autocapture.ts] trackScheduleMeeting - new message calendly",t),t.data.event){case"calendly.event_type_viewed":return e.instance.capture("schedule-a-meeting-start",{service:"Calendly"}),void e.instance.capture("calendly-event-type-viewed",{service:"Calendly"});case"calendly.profile_page_viewed":return void e.instance.capture("calendly-profile-page-viewed",{service:"Calendly"});case"calendly.date_and_time_selected":return void e.instance.capture("calendly-date-and-time-selected",{service:"Calendly"});case"calendly.event_scheduled":var i,r,o=t.data.payload,a=null==o||null===(i=o.event)||void 0===i?void 0:i.uri,s=null==o||null===(r=o.invitee)||void 0===r?void 0:r.uri;return e.instance.capture("calendly-event-scheduled",{service:"Calendly",event:a,invitee:s}),void e.instance.capture("schedule-a-meeting-succeeded",{event:a,invitee:s})}if(e._isHubspotEvent(t)){var c;U.info("[autocapture.ts] trackScheduleMeeting - new message hubspot",t);var l=(null==t||null===(c=t.data)||void 0===c?void 0:c.forwardedData)||(null==t?void 0:t.data)||{};if("readyForConsentListener"===l)e.instance.capture("schedule-a-meeting-start",{service:"HubSpot"});else if(l.meetingBookFailed){var u,d;e.instance.capture("schedule-a-meeting-failed",{service:"HubSpot",formGuid:(null===(u=l.meetingsPayload)||void 0===u?void 0:u.formGuid)||"",postResponse:(null===(d=l.meetingsPayload)||void 0===d||null===(d=d.bookingResponse)||void 0===d?void 0:d.postResponse)||""})}else if(l.meetingBookSucceeded){var p,f;e.instance.capture("schedule-a-meeting-succeeded",{service:"HubSpot",formGuid:(null===(p=l.meetingsPayload)||void 0===p?void 0:p.formGuid)||"",postResponse:(null===(f=l.meetingsPayload)||void 0===f||null===(f=f.bookingResponse)||void 0===f?void 0:f.postResponse)||""})}}var g=(null==t||null===(n=t.data)||void 0===n?void 0:n.forwardedData)||(null==t?void 0:t.data)||{};"hsFormCallback"===g.type&&"onFormSubmitted"===g.eventName&&(e.instance.capture("form-submitted",{service:"HubSpot",formGuid:g.id||""}),console.log("Form Submitted! Event data: ".concat(JSON.stringify(g))))}))}}},{key:"_addDomEventHandlers",value:function(){var e=this;if(this.isBrowserSupported()){if(L&&R){var t=function(t){U.info("[autocapture.ts] Autocapture event handler triggered",t.type),t=t||(null==L?void 0:L.event);try{e._captureEvent(t)}catch(e){U.error("[autocapture.ts] Failed to capture event",e)}};U.info("[autocapture.ts] Adding autocapture event handlers"),ne(R,"submit",t,!1,!0),ne(R,"change",t,!1,!0),ne(R,"click",t,!1,!0),this._trackScheduleMeeting()}}else U.info("[autocapture.ts] Disabling Automatic Event Collection because this browser is not supported")}},{key:"isEnabled",get:function(){var e,t;if(this.instance.config.preview_mode)return U.info("[autocapture.ts]: isEnabled - false - preview mode"),!1;var n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ve],i=this._isDisabledServerSide;if(x(i)&&!P(n)&&!this.instance.config.disable_decide)return U.info("[autocapture.ts]: isEnabled - false - decide not yet called"),!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n,o=!this.instance.config.autocapture;return U.info("[autocapture.ts]: isEnabled - ".concat(!o&&!r)),!o&&!r}},{key:"startIfEnabled",value:function(){U.info("[autocapture.ts] Starting Automatic Event Collection"),this.isEnabled&&!this._initialized&&(U.info("[autocapture.ts] Initializing Autocapture"),this._addDomEventHandlers(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(l({},ve,!!e.autocapture_opt_out)),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}},{key:"_previousElementSibling",value:function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Se(t));return t}},{key:"_getAugmentPropertiesFromElement",value:function(e){if(!De(e))return{};var t={};return J(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&je(i)&&(t[n]=i)}})),t}},{key:"_getPropertiesFromElement",value:function(e,t,n){var i,r=e.tagName.toLowerCase(),o={tag_name:r};o.width=null==e?void 0:e.offsetWidth,o.height=null==e?void 0:e.offsetHeight;var a=null==e?void 0:e.getBoundingClientRect();o.top=null==a?void 0:a.top,o.scrollY=null==L?void 0:L.scrollY,o.left=null==a?void 0:a.left,o.scrollX=null==L?void 0:L.scrollX,Pe.indexOf(r)>-1&&!n&&("a"===r.toLowerCase()||"button"===r.toLowerCase()?o.$el_text=qe(1024,ze(e)):o.$el_text=qe(1024,be(e)));var s=we(e);s.length>0&&(o.classes=s.filter((function(e){return""!==e})));var c=null===(i=this.config)||void 0===i?void 0:i.element_attribute_ignorelist;J(e.attributes,(function(n){var i;if((!Le(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&((null==c||!c.includes(n.name))&&!t&&je(n.value)&&(i=n.name,!E(i)||"_ngcontent"!==i.substring(0,10)&&"_nghost"!==i.substring(0,7)))){var r=n.value;"class"===n.name&&(r=ye(r).join(" ")),o["attr__"+n.name]=qe(1024,r)}}));for(var l=1,u=1,d=e;d=this._previousElementSibling(d);)l++,d.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}},{key:"_getDefaultProperties",value:function(e){return{$event_type:e}}},{key:"_getEventTarget",value:function(e){return S(e.target)?e.srcElement||null:null!==(t=e.target)&&void 0!==t&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}},{key:"_captureEvent",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture";U.info("[autocapture.ts] _captureEvent",e.type,n);var i,r=this._getEventTarget(e);(xe(r)&&(U.info("[autocapture.ts] _captureEvent text node"),r=r.parentNode||null),"$autocapture"===n&&"click"===e.type&&e instanceof MouseEvent)&&(this.instance.config.rageclick&&null!==(i=this.rageclicks)&&void 0!==i&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._captureEvent(e,"$rageclick"));if(r&&Te(r,e,this.config,!1,void 0)){var o,a;U.info("[autocapture.ts] _captureEvent should capture element");for(var s=[r],c=r;c.parentNode&&!Ee(c,"body");)ke(c.parentNode)?(s.push(c.parentNode.host),c=c.parentNode.host):(s.push(c.parentNode),c=c.parentNode);var l,u=[],d={},p=!1;J(s,(function(e){var n=De(e);"a"===e.tagName.toLowerCase()&&(l=e.getAttribute("href"),l=n&&je(l)&&l),K(we(e),"ent-no-capture")&&(p=!0),u.push(t._getPropertiesFromElement(e,t.instance.config.mask_all_element_attributes,t.instance.config.mask_all_text));var i=t._getAugmentPropertiesFromElement(e);V(d,i)}));var f=function(e){return e instanceof MouseEvent?{$click_position:{clientX:(null==e?void 0:e.clientX)||0,clientY:(null==e?void 0:e.clientY)||0,pageX:(null==e?void 0:e.pageX)||0,pageY:(null==e?void 0:e.pageY)||0,offsetX:(null==e?void 0:e.offsetX)||0,offsetY:(null==e?void 0:e.offsetY)||0}}:{$click_position:{}}}(e);if(U.info("[autocapture.ts] _captureEvent autocaptureAugmentProperties",d),this.instance.config.mask_all_text||("a"===r.tagName.toLowerCase()||"button"===r.tagName.toLowerCase()?u[0].$el_text=ze(r):u[0].$el_text=be(r)),l&&(u[0].attr__href=l),U.info("[autocapture.ts] _captureEvent elementsJson",u),p)return U.info("[autocapture.ts] _captureEvent aborting - explicit no capture"),!1;var g=V(this._getDefaultProperties(e.type),this._elementsChainAsString?{$elements_chain:$e(u)}:{$elements:u},null!==(o=u[0])&&void 0!==o&&o.$el_text?{$el_text:null===(a=u[0])||void 0===a?void 0:a.$el_text}:{},d,f);return U.info("[autocapture.ts] _captureEvent capture",n,JSON.stringify(g)),this.instance.capture(n,g),!0}U.info("[autocapture.ts] _captureEvent aborting - no match")}},{key:"isBrowserSupported",value:function(){return w(null==R?void 0:R.querySelectorAll)}}])}(),Xe="Thu, 01 Jan 1970 00:00:00 GMT",Ge="";var Ye=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Je(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R;if(Ge)return Ge;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),i=Math.min(n.length,8),r="dmn_chk_"+me(),o=new RegExp("(^|;)\\s*"+r+"=1");!Ge&&i--;){var a=n.slice(i).join("."),s=r+"=1;domain=."+a;t.cookie=s,o.test(t.cookie)&&(t.cookie=s+";expires="+Xe,Ge=a)}return U.info("[storage.ts] (cookieStore) - seekFirstNonPublicSubDomain()",{firstNonPublicSubDomain:Ge}),Ge}(e);if(!n){var i=function(e){var t=e.match(Ye);return t?t[0]:""}(e);i!==n&&U.info("Warning: cookie subdomain discovery mismatch",i,n),n=i}return n?"; domain=."+n:""}return""}var Ve,Ke={is_supported:function(){return!!R},error:function(e){U.error("cookieStore error: "+e)},get:function(e){if(U.info("[storage.ts] (cookieStore) - get()",{name:e}),R){try{for(var t=e+"=",n=R.cookie.split(";").filter((function(e){return e.length})),i=0;i3686.4&&U.warn("cookieStore warning: large cookie, len="+l.length),U.info("[storage.ts] (cookieStore) - set() cookie=",{new_cookie_val:l}),R.cookie=l,l}catch(e){return}},remove:function(e,t){try{U.info("[storage.ts] (cookieStore) - remove() set days to -1",{name:e,cross_subdomain:t}),Ke.set(e,"",-1,t)}catch(e){return}}},Ze=null,Qe={is_supported:function(){if(U.info("[storage.ts] (localStore) - is_supported()",{}),!x(Ze))return Ze;var e=!0;if(S(L))e=!1;else try{var t="__entailssupport__";Qe.set(t,"xyz"),'"xyz"'!==Qe.get(t)&&(e=!1),Qe.remove(t)}catch(t){e=!1}return e||U.error("localStorage unsupported; falling back to cookie store"),Ze=e,e},error:function(e){U.error("localStorage error: "+e)},get:function(e){try{return U.info("[storage.ts] (localStore) - get()",{name:e}),null==L?void 0:L.localStorage.getItem(e)}catch(e){Qe.error(e)}return null},parse:function(e){try{return U.info("[storage.ts] (localStore) - parse()",{name:e}),JSON.parse(Qe.get(e))||{}}catch(e){}return null},set:function(e,t){try{U.info("[storage.ts] (localStore) - set()",{name:e,value:t}),null==L||L.localStorage.setItem(e,JSON.stringify(t))}catch(e){Qe.error(e)}},remove:function(e){try{U.info("[storage.ts] (localStore) - remove()",{name:e}),null==L||L.localStorage.removeItem(e)}catch(e){Qe.error(e)}}},et=[se,oe,ce],tt=t(t({},Qe),{},{parse:function(e){try{U.info("[storage.ts] (localPlusCookieStore) - parse()",{name:e});var t={};try{t=Ke.parse(e)||{}}catch(e){}var n=V(t,JSON.parse(Qe.get(e)||"{}"));return Qe.set(e,n),U.info("[storage.ts] (localPlusCookieStore) - parse() return",{name:e,value:n}),n}catch(e){}return null},set:function(e,t,n,i,r){try{U.info("[storage.ts] (localPlusCookieStore) - set()",{name:e,value:t,days:n,cross_subdomain:i,is_secure:r}),Qe.set(e,t);var o={};et.forEach((function(e){U.info("[storage.ts] (localPlusCookieStore) - set() COOKIE_PERSISTED_PROPERTIES",{value:t,key:e}),t[e]&&(o[e]=t[e])})),U.info("[storage.ts] (localPlusCookieStore) - set() cookiePersistedProperties",o),Object.keys(o).length&&Ke.set(e,o,n,i,r)}catch(e){Qe.error(e)}},remove:function(e,t){try{U.info("[storage.ts] (localPlusCookieStore) - remove()",{name:e,cross_subdomain:t}),null==L||L.localStorage.removeItem(e),Ke.remove(e,t)}catch(e){Qe.error(e)}}}),nt={},it={is_supported:function(){return!0},error:function(e){U.error("memoryStorage error: "+e)},get:function(e){return nt[e]||null},parse:function(e){return nt[e]||null},set:function(e,t){nt[e]=t},remove:function(e){delete nt[e]}},rt=null,ot={is_supported:function(){if(!x(rt))return rt;if(rt=!0,S(L))rt=!1;else try{var e="__support__";ot.set(e,"xyz"),'"xyz"'!==ot.get(e)&&(rt=!1),ot.remove(e)}catch(e){rt=!1}return rt},error:function(e){U.error("sessionStorage error: ",e)},get:function(e){try{return null==L?void 0:L.sessionStorage.getItem(e)}catch(e){ot.error(e)}return null},parse:function(e){try{return JSON.parse(ot.get(e))||null}catch(e){}return null},set:function(e,t){try{null==L||L.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){ot.error(e)}},remove:function(e){try{null==L||L.sessionStorage.removeItem(e)}catch(e){ot.error(e)}}},at=function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",r=[];return J(e,(function(e,i){S(e)||S(i)||"undefined"===i||(t=encodeURIComponent(function(e){return e instanceof File}(e)?e.name:e.toString()),n=encodeURIComponent(i),r[r.length]=n+"="+t)})),r.join(i)},st=function(e,t){for(var n,i=((e.split("#")[0]||"").split("?")[1]||"").split("&"),r=0;r=3&&(t=S(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ut+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ut+")","i"),function(e){if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[ut,t.join(".")]}return[ut,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[St,""]],[/Linux|debian/i,["Linux",""]]],nn=function(e){return Jt.test(e)?It:Yt.test(e)?At:Gt.test(e)?Nt:new RegExp($t,"i").test(e)?$t:new RegExp("("+zt+"|WPDesktop)","i").test(e)?zt:/iPad/.test(e)?ft:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?vt:Vt.test(e)?mt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ht,"i").test(e)?Ht:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(ct).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ut:pt:ut:new RegExp("(pda|"+ct+")","i").test(e)?Ft:new RegExp(dt,"i").test(e)&&!new RegExp(dt+" pc","i").test(e)?Wt:""},rn="https?://(.*)",on=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid"],an={campaignParams:function(e){var t=on.concat(e||[]),n={};return J(t,(function(e){var t=R?st(R.URL,e):"";t.length&&(n[e]=t)})),n},searchEngine:function(){var e=null==R?void 0:R.referrer;return e?0===e.search(rn+"google.([^/?]*)")?"google":0===e.search(rn+"bing.com")?"bing":0===e.search(rn+"yahoo.com")?"yahoo":0===e.search(rn+"duckduckgo.com")?"duckduckgo":null:null},searchInfo:function(){var e=an.searchEngine(),t="yahoo"!=e?"q":"p",n={};if(!x(e)){n.$search_engine=e;var i=R?st(R.referrer,t):"";i.length&&(n.ph_keyword=i)}return n},browser:Qt,browserVersion:function(e,t){var n=Qt(e,t),i=en[n];if(S(i))return null;for(var r=0;r1e3?B.substring(0,997)+"...":B,$browser_version:an.browserVersion(B,navigator.vendor),$browser_language:an.browserLanguage(),$browser_language_prefix:an.browserLanguagePrefix(),$screen_orientation:null==L?void 0:L.screen.orientation.type,$screen_height:null==L?void 0:L.screen.height,$screen_width:null==L?void 0:L.screen.width,$viewport_height:null==L?void 0:L.innerHeight,$viewport_width:null==L?void 0:L.innerWidth,$page_height:an.pageHeight(),$lib:"web",$lib_version:D.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:(Date.now=Date.now||function(){return+new Date},Date.now()/1e3)});return U.info("[event-utils.ts] properties()=".concat(JSON.stringify(i))),i},people_properties:function(){if(!B)return{};var e=u(an.os(B),2),t=e[0],n=e[1];return V(Q({$os:t,$os_version:n,$browser:an.browser(B,navigator.vendor)}),{$browser_version:an.browserVersion(B,navigator.vendor)})}},sn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],cn=function(){return c((function e(t){s(this,e),this.config=t,this.props={},this.campaign_params_saved=!1,this.name=function(e){return e.persistence_name?"en_"+e.persistence_name:"en_ins"}(t),this.storage=this.buildStorage(t),this.load(),this.update_config(t,t),this.save()}),[{key:"buildStorage",value:function(e){U.info("buildStorage",e),-1===sn.indexOf(e.persistence.toLowerCase())&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&Qe.is_supported()?Qe:"localstorage+cookie"===t&&tt.is_supported()?tt:"sessionstorage"===t&&ot.is_supported()?ot:"memory"===t?it:"cookie"===t?Ke:tt.is_supported()?tt:Ke}},{key:"properties",value:function(){var e={};return J(this.props,(function(t,n){if(n===le&&b(t))for(var i=Object.keys(t),r=0;r0&&Math.abs((new Date).getTime()-t)>432e5;return!e||n?(e=me(),U.info("[session-manager.ts] init() - sessionId NOT found - NEW",{sessionId:e}),this.persistence.register(l(l({},oe,e),ae,(new Date).getTime()))):U.info("[session-manager.ts] init() - sessionId - EXIST",{sessionId:e}),e}},{key:"_getLandingPage",value:function(){var e=this.persistence.get_property(ce);return e?U.info("[session-manager.ts] init() - landingPage - EXIST",{landingPage:e}):(U.info("[session-manager.ts] init() - landingPage NOT found - SET",{landingPage:e}),e=location.href,this.persistence.register_once(l({},ce,e),365)),e}}])}(),un=Uint8Array,dn=Uint16Array,pn=Int32Array,fn=new un([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gn=new un([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vn=new un([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hn=function(e,t){for(var n=new dn(31),i=0;i<31;++i)n[i]=t+=1<>1|(21845&Sn)<<1;En=(61680&(En=(52428&En)>>2|(13107&En)<<2))>>4|(3855&En)<<4,bn[Sn]=((65280&En)>>8|(255&En)<<8)>>1}var xn=function(e,t,n){for(var i=e.length,r=0,o=new dn(t);r>c]=l}else for(a=new dn(i),r=0;r>15-e[r]);return a},kn=new un(288);for(Sn=0;Sn<144;++Sn)kn[Sn]=8;for(Sn=144;Sn<256;++Sn)kn[Sn]=9;for(Sn=256;Sn<280;++Sn)kn[Sn]=7;for(Sn=280;Sn<288;++Sn)kn[Sn]=8;var Pn=new un(32);for(Sn=0;Sn<32;++Sn)Pn[Sn]=5;var On=xn(kn,9,0),Tn=xn(Pn,5,0),Dn=function(e){return(e+7)/8|0},Ln=function(e,t,n){return(null==n||n>e.length)&&(n=e.length),new un(e.subarray(t,n))},Cn=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},In=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},An=function(e,t){for(var n=[],i=0;ip&&(p=o[i].s);var f=new dn(p+1),g=Nn(n[u-1],f,0);if(g>t){i=0;var v=0,h=g-t,m=1<t))break;v+=m-(1<>=h;v>0;){var y=o[i].s;f[y]=0&&v;--i){var w=o[i].s;f[w]==t&&(--f[w],++v)}g=t}return{t:new un(f),l:g}},Nn=function e(t,n,i){return-1==t.s?Math.max(e(t.l,n,i+1),e(t.r,n,i+1)):n[t.s]=i},Mn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new dn(++t),i=0,r=e[0],o=1,a=function(e){n[i++]=e},s=1;s<=t;++s)if(e[s]==r&&s!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=e[s]}return{c:n.subarray(0,i),n:t}},Rn=function(e,t){for(var n=0,i=0;i>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o4&&!P[vn[T-1]];--T);var D,L,C,I,A=l+5<<3,N=Rn(r,kn)+Rn(o,Pn)+a,M=Rn(r,p)+Rn(o,v)+a+14+3*T+Rn(E,P)+2*E[16]+3*E[17]+7*E[18];if(c>=0&&A<=N&&A<=M)return jn(t,u,e.subarray(c,c+l));if(Cn(t,u,1+(M15&&(Cn(t,u,H[x]>>5&127),u+=H[x]>>12)}}}else D=On,L=kn,C=Tn,I=Pn;for(x=0;x255){In(t,u,D[($=B>>18&31)+257]),u+=L[$+257],$>7&&(Cn(t,u,B>>23&31),u+=fn[$]);var F=31&B;In(t,u,C[F]),u+=I[F],F>3&&(In(t,u,B>>5&8191),u+=gn[F])}else In(t,u,D[B]),u+=L[B]}return In(t,u,D[256]),u+L[256]},Hn=new pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$n=new un(0),Bn=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),Fn=function(e,t,n,i,r){if(!r&&(r={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),a=new un(o.length+e.length);a.set(o),a.set(e,o.length),e=a,r.w=o.length}return function(e,t,n,i,r,o){var a=o.z||e.length,s=new un(i+a+5*(1+Math.ceil(a/7e3))+r),c=s.subarray(i,s.length-r),l=o.l,u=7&(o.r||0);if(t){u&&(c[0]=o.r>>3);for(var d=Hn[t-1],p=d>>13,f=8191&d,g=(1<7e3||P>24576)&&(I>423||!l)){u=zn(e,c,0,w,b,S,x,P,T,k-T,u),P=E=x=0,T=k;for(var A=0;A<286;++A)b[A]=0;for(A=0;A<30;++A)S[A]=0}var N=2,M=0,R=f,j=L-C&32767;if(I>2&&D==y(k-j))for(var z=Math.min(p,I)-1,H=Math.min(32767,k),$=Math.min(258,I);j<=H&&--R&&L!=C;){if(e[k+N]==e[k+N-j]){for(var B=0;B<$&&e[k+B]==e[k+B-j];++B);if(B>N){if(N=B,M=j,B>z)break;var F=Math.min(j,B-2),W=0;for(A=0;AW&&(W=U,C=q)}}}j+=(L=C)-(C=v[L])&32767}if(M){w[P++]=268435456|yn[N]<<18|wn[M];var X=31&yn[N],G=31&wn[M];x+=fn[X]+gn[G],++b[257+X],++S[G],O=k+N,++E}else w[P++]=e[k],++b[e[k]]}}for(k=Math.max(k,O);k=a&&(c[u/8|0]=l,Y=a),u=jn(c,u+1,e.subarray(k,Y))}o.i=a}return Ln(s,0,i+Dn(u)+r)}(e,null==t.level?6:t.level,null==t.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,n,i,r)},Wn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function qn(e,t){t||(t={});var n=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i>>8;e=n},d:function(){return~e}}}(),i=e.length;n.p(e);var r,o=Fn(e,t,10+((r=t).filename?r.filename.length+1:0),8),a=o.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Wn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}}(o,t),Wn(o,a-8,n.d()),Wn(o,a-4,i),o}var Un="undefined"!=typeof TextEncoder&&new TextEncoder,Xn="undefined"!=typeof TextDecoder&&new TextDecoder;try{Xn.decode($n,{stream:!0}),1}catch(e){}var Gn=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Yn=!!H||!!z,Jn="text/plain",Vn=function(e,n){var i=u(e.split("?"),2),r=i[0],o=i[1],a=t({},n);null==o||o.split("&").forEach((function(e){var t=u(e.split("="),1)[0];delete a[t]}));var s=at(a);return s=s?(o?o+"&":"")+s:o,"".concat(r,"?").concat(s)},Kn=function(e){return"data="+encodeURIComponent("string"==typeof e?e:JSON.stringify(e))},Zn=function(e){var t=e.data,n=e.compression;if(t){if(n===Gn.GZipJS){var i=qn(function(e,t){if(Un)return Un.encode(e);for(var n=e.length,i=new un(e.length+(e.length>>1)),r=0,o=function(e){i[r++]=e},a=0;ai.length){var s=new un(r+8+(n-a<<1));s.set(i),i=s}var c=e.charCodeAt(a);c<128||t?o(c):c<2048?(o(192|c>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++a))>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|63&c)):(o(224|c>>12),o(128|c>>6&63),o(128|63&c))}return Ln(i,0,r)}(JSON.stringify(t)),{mtime:0});return{contentType:Jn,body:new Blob([i],{type:Jn})}}if(n===Gn.Base64){var r=function(e){var t,n,i,r,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,c=0,l="",u=[];if(!e)return e;e=te(e);do{t=(o=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=o>>12&63,i=o>>6&63,r=63&o,u[c++]=a.charAt(t)+a.charAt(n)+a.charAt(i)+a.charAt(r)}while(s=864e5*t},ci=function(e){return e.ON_EXIT_INTENT="on_exit_intent",e.ON_SCROLL="on_scroll",e.ON_SCROLL_TO_ELEMENT="on_scroll_to_element",e.ON_CLICK="on_click",e.ON_TIME_ON_PAGE="on_time_on_page",e.ON_PAGE_LOAD="on_page_load",e.MANUALLY="manually",e.UNKNOWN="na",e.ERROR="error",e}({}),li=function(){return c((function e(t){var i=this;s(this,e),l(this,"HTMLs",new Map),l(this,"_isAPopupOpen",!1),l(this,"appendToBody",(function(e,t){try{var n,i,r,o=document.querySelector("body"),a=document.createElement("div");a.id="dialog-root-".concat(t._id),o.append(a),U.info("[popup-manager.ts]: open in shadowRoot in layout",null===(n=t.settings)||void 0===n||null===(n=n.layout)||void 0===n?void 0:n.shadowRoot);var s=null===(i=null===(r=t.settings)||void 0===r||null===(r=r.layout)||void 0===r?void 0:r.shadowRoot)||void 0===i||i;U.info("[popup-manager.ts]: open in shadowRoot",s);var c=s?a.attachShadow({mode:"open"}):a,l=document.createElement("style");l.id="emotion-root";var u=document.createRange().createContextualFragment(e);c.appendChild(l),c.appendChild(u)}catch(e){U.error(e)}})),this.config=t,window.addEventListener("close_entail_dialog",function(){var e=a(n().mark((function e(t){var r,o,a,s,c;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info("[popup-manager.ts]: close_entail_dialog",t),s=null==t||null===(r=t.detail)||void 0===r?void 0:r.widget_id,c=null==t||null===(o=t.detail)||void 0===o?void 0:o.triggered_by,null===(a=window.document.getElementById("dialog-root-".concat(s)))||void 0===a||a.remove(),i._isAPopupOpen=!1,i.onPopupCloseHandler&&i.onPopupCloseHandler(s,i.currentOpenPopupTrigger||ci.UNKNOWN,c),i.currentOpenPopup=void 0,i.currentOpenPopupTrigger=void 0;case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}),[{key:"onPopupOpen",value:function(e){this.onPopupOpenHandler=e}},{key:"onPopupClose",value:function(e){this.onPopupCloseHandler=e}},{key:"manuallyShowPopup",value:(r=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U.info("%c[popup-manager.ts]: manuallyShowPopup: %s","background: #111; color: #dada55",JSON.stringify(t,void 0,4)),e.next=3,this.showPopup(t,ci.MANUALLY);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"showPopup",value:(i=a(n().mark((function e(t,i){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U.info("%c[popup-manager.ts]: showPopup: %s","background: #111; color: #dada55",i),!this._isAPopupOpen){e.next=4;break}return U.info("[popup-manager.ts]: showPopup: have an opened popup"),e.abrupt("return");case 4:return this._isAPopupOpen=!0,this.currentOpenPopup=t,this.currentOpenPopupTrigger=i,U.info("%c[popup-manager.ts]: showPopup: Open Popup: %s, %s","background: #111; color: #dada55",i,JSON.stringify(t,void 0,4)),e.next=10,this.show();case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"show",value:(t=a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.currentOpenPopup){e.next=2;break}return e.abrupt("return");case 2:if(t="",!this.HTMLs.has(this.currentOpenPopup._id)){e.next=7;break}t=this.HTMLs.get(this.currentOpenPopup._id),e.next=11;break;case 7:return e.next=9,this.getPopupHtml(this.currentOpenPopup._id);case 9:(t=e.sent)&&this.HTMLs.set(this.currentOpenPopup._id,t);case 11:if(t){e.next=15;break}return this.onPopupOpenHandler&&this.onPopupOpenHandler(this.currentOpenPopup._id,(null==this?void 0:this.currentOpenPopupTrigger)||ci.UNKNOWN),this.onPopupCloseHandler&&this.onPopupCloseHandler(this.currentOpenPopup._id,this.currentOpenPopupTrigger||ci.UNKNOWN,ci.ERROR),e.abrupt("return");case 15:this.onPopupOpenHandler&&this.onPopupOpenHandler(this.currentOpenPopup._id,(null==this?void 0:this.currentOpenPopupTrigger)||ci.UNKNOWN),this.appendToBody(t,this.currentOpenPopup);case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getPopupHtml",value:(e=a(n().mark((function e(t){var i,r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat(this.config.popups_api_host,"/widget/").concat(t),{headers:{"X-Access-Token":this.config.token}});case 3:if((i=e.sent).ok){e.next=6;break}return e.abrupt("return");case 6:return e.next=8,i.json();case 8:return r=e.sent,e.abrupt("return",r.html);case 12:return e.prev=12,e.t0=e.catch(0),U.error(e.t0),e.abrupt("return");case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(t){return e.apply(this,arguments)})}]);var e,t,i,r}(),ui=function(){return c((function e(){s(this,e)}),[{key:"listen",value:function(e,t){U.info("[popup-triggers.ts]: clickTriggerInit");var n,i=g(e);try{var r=function(){var e,i=n.value;if(null!==(e=i.settings.triggers.onClick)&&void 0!==e&&e.value){var r;U.info("[popup-triggers.ts]: clickTriggerInit on",i.settings.triggers.onClick.elementId);var o=(null===(r=i.settings.triggers.onClick.elementId)||void 0===r||null===(r=r.replace(/\s/g,""))||void 0===r?void 0:r.split(","))||[];U.info("[popup-triggers.ts]: clickTriggerInit elementIds",o);var a,s=g(o);try{for(s.s();!(a=s.n()).done;){var c=a.value;if(c){var l=window.document.getElementById(c);U.info("[popup-triggers.ts]: clickTriggerInit - element",c,l),l&&(U.info("[popup-triggers.ts]: clickTriggerInit - pending for click on ".concat(c)),l.addEventListener("click",(function(){U.info("[popup-triggers.ts]: clickTriggerInit - show on click"),t.showPopup(i,ci.ON_CLICK)})))}}}catch(e){s.e(e)}finally{s.f()}}};for(i.s();!(n=i.n()).done;)r()}catch(e){i.e(e)}finally{i.f()}}},{key:"terminate",value:function(){}}])}(),di=function(){return c((function e(){s(this,e)}),[{key:"listen",value:function(e,t){var n=0;this.interval=setInterval((function(){var i,r=g(e);try{for(r.s();!(i=r.n()).done;){var o,a=i.value;if(null!==(o=a.settings.triggers.timeOnPage)&&void 0!==o&&o.value&&Number(a.settings.triggers.timeOnPage.duration)===n){U.info("[popup-triggers.ts]: timeTriggerInit - show on time"),t.showPopup(a,ci.ON_TIME_ON_PAGE);break}}}catch(e){r.e(e)}finally{r.f()}n++}),1e3)}},{key:"terminate",value:function(){clearInterval(this.interval)}}])}(),pi=function(){return c((function e(){var t=this;s(this,e),l(this,"_handler",(function(e,n){U.info("[popup-triggers.ts]: scrollTriggerInit - scroll event",e);var i,r=g(e);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.settings.triggers.onScrollElement.value&&o.settings.triggers.onScrollElement.elementId&&t.isScrolledToElement(o.settings.triggers.onScrollElement)){U.info("[popup-triggers.ts]: scrollTriggerInit - show on scroll element"),n.showPopup(o,ci.ON_SCROLL_TO_ELEMENT);break}if(o.settings.triggers.onScroll.value&&o.settings.triggers.onScroll.scrollPosition&&t.onScroll(o.settings.triggers.onScroll)){U.info("[popup-triggers.ts]: scrollTriggerInit - show on scroll"),n.showPopup(o,ci.ON_SCROLL);break}}}catch(e){r.e(e)}finally{r.f()}}))}),[{key:"listen",value:function(e,t){var n=e.filter((function(e){var t,n;return(null==e||null===(t=e.settings)||void 0===t||null===(t=t.triggers)||void 0===t||null===(t=t.onScroll)||void 0===t?void 0:t.value)||(null==e||null===(n=e.settings)||void 0===n||null===(n=n.triggers)||void 0===n||null===(n=n.onScrollElement)||void 0===n?void 0:n.value)}));0!==n.length&&(this.listener=this._handler.bind(null,n,t),window.addEventListener("scroll",this.listener))}},{key:"terminate",value:function(){window.removeEventListener("scroll",this.listener)}},{key:"isScrolledToElement",value:function(e){var t=document.getElementById(e.elementId);if(U.info("[popup-triggers.ts]: isScrollElement - target",e.elementId,t),t){var n=t.getBoundingClientRect(),i=n.top=0;return U.info("[popup-triggers.ts]: isScrollElement - position",n,i),i}return!1}},{key:"onScroll",value:function(e){var t=document.documentElement.scrollHeight-document.documentElement.clientHeight,n=document.documentElement.scrollTop;return e.scrollPosition/100<=n/t}}])}(),fi=function(){return c((function e(){s(this,e)}),[{key:"listen",value:function(e,t){var n,i=g(e);try{for(i.s();!(n=i.n()).done;){var r,o=n.value;if(null!=o&&null!==(r=o.settings)&&void 0!==r&&null!==(r=r.triggers)&&void 0!==r&&r.onPageLoad.value){U.info("[popup-triggers.ts]: pageLoadTriggerInit - show"),t.showPopup(o,ci.ON_PAGE_LOAD);break}}}catch(e){i.e(e)}finally{i.f()}}},{key:"terminate",value:function(){}}])}(),gi=function(){return c((function e(){s(this,e),l(this,"_handler",(function(e,t,n){var i=n||window.event;if("input"!=i.target.tagName.toLowerCase()){var r=Math.max(document.documentElement.clientWidth,window.innerWidth||0);if(!(i.clientX>=r-50||i.clientY>=50)){var o=i.relatedTarget||i.toElement;U.info("[popup-triggers.ts]: ExitIntentTrigger - ".concat(o?"No":"Show")),o||t.showPopup(e[0],ci.ON_EXIT_INTENT)}}}))}),[{key:"listen",value:function(e,t){U.info("[popup-triggers.ts]: ExitIntentTrigger - listen");var n=e.filter((function(e){var t;return null==e||null===(t=e.settings)||void 0===t||null===(t=t.triggers)||void 0===t||null===(t=t.onExitIntent)||void 0===t?void 0:t.value}));0!==n.length?(this.listener=this._handler.bind(null,n,t),window.addEventListener("mouseout",this.listener)):U.info("[popup-triggers.ts]: ExitIntentTrigger - No popups")}},{key:"terminate",value:function(){U.info("[popup-triggers.ts]: ExitIntentTrigger - terminate"),window.removeEventListener("mouseout",this.listener)}}])}(),vi=function(){return c((function e(t){s(this,e),l(this,"_initialized",!1),this.config=t,this.clickTrigger=new ui,this.timeTrigger=new di,this.scrollTrigger=new pi,this.pageTrigger=new fi,this.exitIntentTrigger=new gi}),[{key:"listen",value:function(e,t){U.info("[popups-triggers.ts]: start"),this.clickTrigger.terminate(),this.clickTrigger.listen(e,t),this.timeTrigger.terminate(),this.timeTrigger.listen(e,t),this.scrollTrigger.terminate(),this.scrollTrigger.listen(e,t),this.pageTrigger.terminate(),this.pageTrigger.listen(e,t),this.exitIntentTrigger.terminate(),this.exitIntentTrigger.listen(e,t)}}])}(),hi="entail_dialog_list_fetched_date",mi="entail_dialog_list",_i="entail_dialog_meta_data",yi=function(){return c((function e(i){var r=this;s(this,e),l(this,"_isDisabledServerSide",null),l(this,"popups",[]),l(this,"pendingPopups",[]),l(this,"popupsMetaData",{}),l(this,"_initialized",!1),l(this,"_dialogListeners",(function(){r.popupsManager.onPopupOpen((function(e,n){var i,o=r.popups.find((function(t){return t._id===e})),a=r.popupsMetaData[e];r.instance.capture("dialog-open",{dialog_id:null==o?void 0:o._id,dialog_cms_id:null==o?void 0:o.snId,dialog_name:null==o?void 0:o.name,dialog_show_first_time:a.isShownForTheFirstTime,dialog_open_trigger:n}),r.popupsMetaData[e].lastShownDate=new Date,r.popupsMetaData[e].triggersLastShownDate=t(t({},r.popupsMetaData[e].triggersLastShownDate||{}),{},l({},n,new Date)),r.popupsMetaData[e].isShownForTheFirstTime=!1,null===(i=r.sessionPersistence)||void 0===i||i.set_property(_i,r.popupsMetaData),r.pendingPopups.findIndex((function(t){return t._id===e}))<0||r._updatePendingDialogList()})),r.popupsManager.onPopupClose((function(e,t,n){var i,o=r.popups.find((function(t){return t._id===e})),a=r.popupsMetaData[e];r.instance.capture("dialog-close",{dialog_id:null==o?void 0:o._id,dialog_cms_id:null==o?void 0:o.snId,dialog_name:null==o?void 0:o.name,dialog_show_first_time:a.isShownForTheFirstTime,dialog_open_trigger:t,dialog_close_trigger:n}),r.popupsMetaData[e].closedByButton=!0,null===(i=r.sessionPersistence)||void 0===i||i.set_property(_i,r.popupsMetaData),r._updatePendingDialogList()}))})),l(this,"_initialize",a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U.info("[popups.ts]: initialize"),e.next=3,r._updateDialogList();case 3:r._updatePendingDialogList(),r._observePageChange(),r._dialogListeners(),U.info("[popups.ts]: ".concat(r.popups.length," active popups"));case 7:case"end":return e.stop()}}),e)})))),l(this,"_startTriggerListeners",(function(){r.popupTriggers.listen(r.pendingPopups,r.popupsManager)})),l(this,"_observePageChange",(function(){r._startTriggerListeners(),window.addEventListener("entail_on_locationchange",a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return U.info("[popups.ts]: URL changed!",window.location.href),e.next=3,r._updateDialogList();case 3:r._updatePendingDialogList();case 4:case"end":return e.stop()}}),e)}))))})),l(this,"_fetchActiveDialogs",a(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat(r.instance.config.popups_api_host,"/widget/dialogs/list"),{headers:{"X-Access-Token":r.instance.config.token}});case 3:if((t=e.sent).ok){e.next=6;break}return e.abrupt("return");case 6:return e.next=8,t.json();case 8:return e.abrupt("return",e.sent.dialogs);case 11:return e.prev=11,e.t0=e.catch(0),U.info(e.t0),e.abrupt("return");case 15:case"end":return e.stop()}}),e,null,[[0,11]])})))),l(this,"_updateDialogList",a(n().mark((function e(){var t,i,o,a,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=null===(t=r.sessionPersistence)||void 0===t?void 0:t.get_property(hi),r.popups=null===(i=r.sessionPersistence)||void 0===i?void 0:i.get_property(mi),!s||!r.popups||si(s,1)){e.next=6;break}return U.info("[popups.ts]: get popups from session storage",r.popups.length),r._updateOrCreatePopupsMetaData(),e.abrupt("return",r.popups);case 6:return U.info("[popups.ts]: fetching popups from server"),e.next=9,r._fetchActiveDialogs();case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0=[];case 12:return r.popups=e.t0,U.info("[popups.ts]: popups fetched",r.popups.length),r._updateOrCreatePopupsMetaData(),null===(o=r.sessionPersistence)||void 0===o||o.set_property(mi,r.popups),null===(a=r.sessionPersistence)||void 0===a||a.set_property(hi,(new Date).toString()),e.abrupt("return",r.popups);case 18:case"end":return e.stop()}}),e)})))),l(this,"_updateOrCreatePopupsMetaData",(function(){var e;if(U.info("[popups.ts]: _updateOrCreatePopupsMetaData"),r.popupsMetaData=null===(e=r.sessionPersistence)||void 0===e?void 0:e.get_property(_i),!r.popupsMetaData){var t;U.info("[popups.ts]: _updateOrCreatePopupsMetaData","create new meta data"),r.popupsMetaData={};var n,i=g(r.popups);try{for(i.s();!(n=i.n()).done;){var o=n.value;r.popupsMetaData[o._id]={isShownForTheFirstTime:!0}}}catch(e){i.e(e)}finally{i.f()}U.info("[popups.ts]: _updateOrCreatePopupsMetaData loaded: ",r.popupsMetaData),null===(t=r.sessionPersistence)||void 0===t||t.set_property(_i,r.popupsMetaData)}return r.popupsMetaData})),l(this,"_passDialogFrequencyRule",(function(e,t){if(t.isShownForTheFirstTime)return!0;switch(e.settings.frequency){case"everyday":return Boolean(t.lastShownDate&&si(t.lastShownDate,1));case"everyweek":return Boolean(t.lastShownDate&&si(t.lastShownDate,7));case"once":return!1;case"everytime":return!0;case"everytime_until_closed":return!1===t.closedByButton;default:return U.error("[popups.ts]: frequency not found",e.settings.frequency),!1}})),l(this,"_passPagesRules",(function(e){var t=window.location.href.replace(location.search,"").replace(location.hash,"");switch(U.info("[popups.ts]: updatePendingDialogList: thisUrl - ".concat(t)),e.settings.pages.value){case"specific":if(0===e.settings.pages.specificPages.length)return U.info("[popups.ts]: updatePendingDialogList: specific but pages list is empty - remove"),!1;var n=e.settings.pages.specificPages.some((function(e){return e.endsWith("*")?t.startsWith(e.replace("*","")):t===e}));return U.info("[popups.ts]: updatePendingDialogList: specific page- ".concat(n?"keep":"remove")),n;case"excluded":if(0===e.settings.pages.excludedPages.length)return U.info("[popups.ts]: updatePendingDialogList: excluded but pages list is empty - remove"),!1;var i=e.settings.pages.excludedPages.some((function(e){return e.endsWith("*")?t.startsWith(e.replace("*","")):t===e}));return U.info("[popups.ts]: updatePendingDialogList: excluded page - ".concat(i?"remove":"keep")),!i;case"all":return!0;default:return U.error("[popups.ts]: pages value not found",e.settings.pages.value),!1}})),l(this,"_passDisplayDevicesRule",(function(e){var t=window.innerWidth,n="mobile";return t>1024?n="desktop":t>768&&t<=1024&&(n="tablet"),U.info("[popups.ts]: updatePendingDialogList: screen size - ".concat(n)),e.settings.displayDevices.includes(n)})),l(this,"_updatePendingDialogList",(function(){U.info("[popups.ts]: updatePendingDialogList"),r.pendingPopups=r.popups.filter((function(e){U.info("[popups.ts]: updatePendingDialogList dialog",e);var t=r.popupsMetaData[e._id];if(U.info("[popups.ts]: updatePendingDialogList, meta data",t),!t)return U.info("[popups.ts]: updatePendingDialogList: widgetMetaData is not found - remove",r.popupsMetaData),!1;if(!e.settings.frequency)return U.info("[popups.ts]: updatePendingDialogList: frequency is not found - remove"),!1;var n=r._passDialogFrequencyRule(e,t);U.info("[popups.ts]: updatePendingDialogList: isTimeToShow - firstTime=".concat(t.isShownForTheFirstTime),", frequency=".concat(e.settings.frequency," - "),n?"keep":"remove");var i=r._passDisplayDevicesRule(e);U.info("[popups.ts]: updatePendingDialogList: displayDevices - ".concat(i?"keep":"remove"));var o=r._passPagesRules(e);return U.info("[popups.ts]: updatePendingDialogList: passPageRules - ".concat(o)),U.info("[popups.ts]: updatePendingDialogList: ".concat(o&&i&&n?"KEEP":"REMOVE")),o&&i&&n})).map((function(e){var n,i,o,a,s,c=r.popupsMetaData[e._id];if(c.isShownForTheFirstTime&&(!c.lastShownDate||si(c.lastShownDate,1)))return U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," return all triggers showFirstTime=").concat(c.isShownForTheFirstTime,", lastShownDate=").concat(c.lastShownDate)),{_id:e._id,settings:e.settings};var l=e.settings.triggers;return null!==(n=c.triggersLastShownDate)&&void 0!==n&&n[ci.ON_SCROLL]&&!si(c.triggersLastShownDate[ci.ON_SCROLL],1)&&(U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," remove onScroll trigger")),l.onScroll.value=!1),null!==(i=c.triggersLastShownDate)&&void 0!==i&&i[ci.ON_SCROLL_TO_ELEMENT]&&!si(c.triggersLastShownDate[ci.ON_SCROLL_TO_ELEMENT],1)&&(U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," remove onScrollToElement trigger")),l.onScrollElement.value=!1),null!==(o=c.triggersLastShownDate)&&void 0!==o&&o[ci.ON_PAGE_LOAD]&&!si(c.triggersLastShownDate[ci.ON_PAGE_LOAD],1)&&(U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," remove onPageLoad trigger")),l.onPageLoad.value=!1),null!==(a=c.triggersLastShownDate)&&void 0!==a&&a[ci.ON_TIME_ON_PAGE]&&!si(c.triggersLastShownDate[ci.ON_TIME_ON_PAGE],1)&&(U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," remove timeOnPage trigger")),l.timeOnPage.value=!1),null!==(s=c.triggersLastShownDate)&&void 0!==s&&s[ci.ON_EXIT_INTENT]&&!si(c.triggersLastShownDate[ci.ON_EXIT_INTENT],1)&&(U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," remove onExitIntent trigger")),l.onExitIntent.value=!1),U.info("[popups.ts]: updatePendingDialogList: ".concat(e._id," triggers"),l),{_id:e._id,settings:t(t({},e.settings),{},{triggers:l})}})),U.info("[popups.ts]: ".concat(r.pendingPopups?r.pendingPopups.length:"No"," pending dialogs")),r._startTriggerListeners()})),this.instance=i,this.sessionPersistence=new cn(t(t({},this.instance.config),{},{persistence:"sessionStorage",persistence_name:"dialogs"})),this.popupsManager=new li(this.instance.config),this.popupTriggers=new vi(this.instance.config)}),[{key:"isEnabled",get:function(){var e,t;if(this.instance.config.preview_mode)return U.info("[popups.ts]: isEnabled - false - preview mode"),!1;var n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props[ge],i=this._isDisabledServerSide;if(x(i)&&!P(n)&&!this.instance.config.disable_decide)return U.info("[popups.ts]: isEnabled - false - decide not yet called"),!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n,o=!this.instance.config.popups;return U.info("[popups.ts]: isEnabled - ".concat(!o&&!r)),!o&&!r}},{key:"startIfEnabled",value:function(){U.info("[popups.ts]: Starting Popups Factory"),this.isEnabled&&!this._initialized?(U.info("[popups.ts]: Initializing Popups"),this._initialize(),this._initialized=!0):U.info("[popups.ts]: DISABLED!")}},{key:"afterDecideResponse",value:function(e){this.instance.persistence&&this.instance.persistence.register(l({},ge,!!e.popups_opt_out)),this._isDisabledServerSide=!!e.popups_opt_out,U.info("[popups.ts]: _isDisabledServerSide",this._isDisabledServerSide),this.startIfEnabled()}},{key:"showPopup",value:function(e){var t;U.info("[popups.ts]: showPopup - ".concat(e));var n=this.popups.findIndex((function(t){return t._id===e}));n<0&&U.info("[popups.ts]: showPopup - popup not found ".concat(e));var i=n>-1?{_id:this.popups[n]._id,settings:this.popups[n].settings}:{_id:e};null===(t=this.popupsManager)||void 0===t||t.manuallyShowPopup(i)}}])}(),wi=function(){return c((function e(t){s(this,e),this.instance=t}),[{key:"call",value:function(){var e=this;if(U.info("[decide.ts]: Fetching features."),this.instance.config.preview_mode)U.info("[decide.ts]: Running in preview mode");else{var t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id()};this.instance._send_request({method:"POST",url:"".concat(this.instance.config.decide_api_host,"/decide/").concat(this.instance.config.token),data:t,compression:this.instance.config.disable_compression?void 0:Gn.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(t){return e.parseDecideResponse(t.json)}})}}},{key:"parseDecideResponse",value:function(e){var t=this;if(e)return R&&R.body?void this.instance._afterDecideResponse(e):(U.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((function(){t.parseDecideResponse(e)}),500));U.error("Failed to fetch feature flags from Entail.")}}])}(),bi=function(){return c((function e(t){var i=this;s(this,e),l(this,"_isDisabledServerSide",null),l(this,"_initialized",!1),l(this,"inactivityPeriod",500),l(this,"observer",new MutationObserver((function(e){clearTimeout(i.timeoutId),i.timeoutId=setTimeout((function(){U.info("[campaigns.ts]: Page is fully loaded"),i._injectContainers(),i.observer.disconnect()}),i.inactivityPeriod)}))),l(this,"_addObserverIfDesiredNodeAvailable",(function(){var e=document.getElementsByTagName("body")[0];if(!e)return U.info("[campaigns.ts]: failed start observing - node not ready ".concat(e)),void window.setTimeout((function(){return i._addObserverIfDesiredNodeAvailable()}),500);U.info("[campaigns.ts]: start observing ".concat(e));i.observer.observe(e,{childList:!0,subtree:!0,characterData:!0}),i.timeoutId=setTimeout((function(){U.info("[campaigns.ts]: Page is fully loaded"),i.observer.disconnect(),i._injectContainers()}),i.inactivityPeriod)})),l(this,"_waitForPageFullyLoaded",(function(){U.info("[campaigns.ts]: _waitForPageFullyLoaded"),i._addObserverIfDesiredNodeAvailable()})),l(this,"_getElementsByTextSelector",(function(e){var t=e,n=t.tagName,i=t.textContent;U.info("[campaigns.ts]: _getElementsByTextSelector",n);var r={img:'//img[contains(@src, "'.concat(i,'") or contains(@alt, "').concat(i,'")]'),video:'//video[contains(@src, "'.concat(i,'")]'),iframe:'//iframe[contains(@src, "'.concat(i,'")]'),figure:'//figure[normalize-space() or ./figcaption[contains(normalize-space(), "'.concat(i,'")]]'),picture:'//picture[normalize-space() or ./source[contains(@src, "'.concat(i,'") or contains(@srcset, "').concat(i,'")]]')},o="//".concat(n,"[contains(translate(normalize-space(), ' \t\n\r', ' '), \"").concat(i,'")]'),a=r[n]||o;try{var s=document.evaluate(a,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);return Array.from({length:s.snapshotLength},(function(e,t){return s.snapshotItem(t)}))}catch(e){return U.error("[campaigns.ts]: getElementsByTextSelector error for tagName: ".concat(n,", text: ").concat(i)),[]}})),l(this,"_getElementByTextSelector",(function(e){try{U.info("[campaigns.ts]: _getElementByTextSelector");var t=i._getElementsByTextSelector(e);if(!t.length)return U.error("[campaigns.ts]: _getElementByTextSelector invalid textContent - element not found",e),{element:null,isUnique:!1};var n=t[t.length-1];return t.filter((function(e){return e&&!e.isEqualNode(n)})).every((function(e){return e&&e.contains(n)}))?{element:n,isUnique:!0}:(U.error("[campaigns.ts]: _getElementByTextSelector invalid textContent - element not unique",e,"elements",t),{element:n,isUnique:!1})}catch(e){return U.error("[campaigns.ts]: _getElementByTextSelector error",e),{element:null,isUnique:!1}}})),l(this,"_injectContainers",(function(){i.campaigns.map((function(e){var t,n,r,o;U.info("[campaigns.ts]: _injectContainers - campaign ".concat(null==e?void 0:e.campaignId),document.readyState);var a=null;if(null!==(t=e.position)&&void 0!==t&&null!==(t=t.selector)&&void 0!==t&&t.textSelector){var s=i._getElementByTextSelector(e.position.selector.textSelector);s.element&&s.isUnique&&(U.info("[campaigns.ts]: _injectContainers - campaign ".concat(e.containerId," - loading by Text selector ").concat(e.position.selector.textSelector)),a=s.element)}if(a||"css"!==(null===(n=e.position)||void 0===n||null===(n=n.selector)||void 0===n?void 0:n.type)||(a=document.querySelector(e.position.selector.value))&&U.info("[campaigns.ts]: _injectContainers - campaign ".concat(e.containerId," - loading by CSS selector ").concat(e.position.selector.value)),a||"XPath"!==(null===(r=e.position)||void 0===r||null===(r=r.selector)||void 0===r?void 0:r.type)||(a=document.evaluate(e.position.selector.value,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue)&&U.info("[campaigns.ts]: _injectContainers - campaign ".concat(e.containerId," - loading by XPath selector ").concat(e.position.selector.type)),!a&&null!==(o=e.position)&&void 0!==o&&null!==(o=o.selector)&&void 0!==o&&o.shortestCssSelector&&(a=document.querySelector(e.position.selector.shortestCssSelector))&&U.info("[campaigns.ts]: _injectContainers - campaign ".concat(e.containerId," - loading by shortest CSS selector ").concat(e.position.selector.shortestCssSelector)),a){U.info("[campaigns.ts]: _injectContainers - campaign ".concat(e.containerId," - anchor ").concat(a," at ").concat(e.position.selector.type," - ").concat(e.position.selector.value));var c,l,u="auto";if("specific"===e.widgetFilter.value)null!==(c=e.widgetFilter)&&void 0!==c&&c.widget||U.info('[campaigns.ts]: Error, "specific" widget but no widget provided for campaign '.concat(e.containerId)),u=(null===(l=e.widgetFilter)||void 0===l?void 0:l.widget)||"auto";if(document.querySelector('[entail-campaign-mode="auto"][entail-container-id="'.concat(e.containerId,'"][entail-widget-id="').concat(u,'"][entail-campaign-id="').concat(e.campaignId,'"]')))U.info("%c[campaigns.ts]: campaign container ".concat(e.containerId," already exist, ignoring duplicates"),"background: #212; color: #45da55");else{var d='
');"above"===e.position.position?(U.info("%c[campaigns.ts]: injecting campaign container ".concat(e.containerId," above anchor"),"background: #212; color: #45da55"),a.insertAdjacentHTML("beforebegin",d)):(U.info("%c[campaigns.ts]: injecting campaign container ".concat(e.containerId," below anchor"),"background: #212; color: #45da55"),a.insertAdjacentHTML("afterend",d))}}else U.info("[campaigns.ts]: _injectContainers - campaign ".concat(e.containerId," - anchor not found at ").concat(e.position.selector.type," - ").concat(e.position.selector.value))}))})),l(this,"_getCampaigns",(function(){U.info("[campaigns.ts]: getCampaigns"),fetch("".concat(i.instance.config.campaigns_api_host,"/campaigns/list"),{method:"POST",body:JSON.stringify({url:window.location.href})}).then((function(e){return e.json()})).then((function(e){i.campaigns=e.campaigns||[],U.info("[campaigns.ts]: getCampaigns - fetched",i.campaigns.length),i.campaigns.length>0&&i._waitForPageFullyLoaded()}))})),l(this,"_initialize",a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U.info("[campaigns.ts]: initialize"),i._observeHistory(),i._getCampaigns();case 3:case"end":return e.stop()}}),e)})))),this.instance=t,this.campaigns=[]}),[{key:"_cleanup",value:function(){this.campaigns.map((function(e){var t=document.querySelector('div[entail-container-id="'.concat(e.containerId,'"]'));t&&(U.info("[campaigns.ts]: _cleanup - ",'[entail-container-id="'.concat(e.containerId,'"]')),t.remove())})),U.info("[campaigns.ts]: _cleanup!",this.campaigns.length),this.campaigns.splice(0,this.campaigns.length),this.observer.disconnect()}},{key:"_observeHistory",value:function(){var e=this;window.addEventListener("entail_on_locationchange",(function(){U.info("[campaigns.ts]: URL changed!",window.location.href),e._cleanup(),e._getCampaigns()}))}},{key:"isEnabled",get:function(){var e,t;if(this.instance.config.preview_mode)return U.info("[campaigns.ts]: isEnabled - false - preview mode"),!1;var n=null===(e=this.instance.persistence)||void 0===e?void 0:e.props.$campaigns_disabled_server_side,i=this._isDisabledServerSide;if(x(i)&&!P(n)&&!this.instance.config.disable_decide)return U.info("[campaigns.ts]: isEnabled - false - decide not yet called"),!1;var r=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!n,o=!this.instance.config.campaigns;return U.info("[campaigns.ts]: isEnabled disabledClient=".concat(o,", disabledServer=").concat(r,"- ").concat(!o&&!r)),!o&&!r}},{key:"startIfEnabled",value:function(){U.info("[campaigns.ts]: Starting Campaigns Manager"),this.isEnabled&&!this._initialized&&(U.info("[campaigns.ts]: Initializing Campaigns"),this._initialize(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(e){this.instance.persistence&&this.instance.persistence.register(l({},fe,!!e.widgets_opt_out)),this._isDisabledServerSide=!!e.widgets_opt_out,this.startIfEnabled()}}])}(),Si=function(){},Ei="entailInsights",xi={},ki=!Yn&&-1===(null==B?void 0:B.indexOf("MSIE"))&&-1===(null==B?void 0:B.indexOf("Mozilla"));U.info("entail-js - ".concat("production"));var Pi=function(){return c((function e(){var n,i,r,o,a=this;s(this,e),l(this,"init",(function(t,n,i){if(U.info("EntailInsights version: 1.0.1"),i&&i!==Ei){var r,o=null!==(r=xi[i])&&void 0!==r?r:new e;return o._init(t,n,i),xi[i]=o,xi[Ei][i]=o,o}return a._init(t,n,i)})),l(this,"getDefaultPayload",(function(e){var n,i,r=location,o=r.hostname,s=r.pathname,c=r.search,l="".concat(s).concat(c),u=null===(n=a.persistence)||void 0===n?void 0:n.get_property(se),d=null===(i=a.persistence)||void 0===i?void 0:i.get_property(oe),p=a._getLocationQueryParams(l),f=an.properties(),g=an.referrerInfo();U.info("Default props - Info.properties()=".concat(JSON.stringify(f))),U.info("Default props - Info.referrerInfo()=".concat(JSON.stringify(g)));var v=t(t({token:a.config.token,$ent_version:"1.0",hostname:o,deviceUUID:u,sessionUUID:d,queryParams:p},f),g);if(!a.config.disable_scroll_properties){var h={};"$pageview"===e?h=a.pageViewManager.doPageView():"$pageleave"===e&&(h=a.pageViewManager.doPageLeave()),U.info("Default props - performanceProperties=",h),v=t(t({},v),h)}return"$pageview"===e&&document&&(v.title=document.title),U.info("Default props",v),v})),l(this,"_getLocationQueryParams",(function(e){try{var t=e.split("?");if(t.length>1){var n,i={},r=g(new URLSearchParams(t[1]).entries());try{for(r.s();!(n=r.n()).done;){var o=u(n.value,2),a=o[0],s=o[1];i[a]=s}}catch(e){r.e(e)}finally{r.f()}return i}return{}}catch(e){return{}}})),this.__loaded=!1,this.language=(null==M?void 0:M.language)||"en",this.config={api_host:"https://t.entail-insights.com",decide_api_host:"https://widgets.entail.ai",widgets_api_host:"https://widgets.entail.ai",popups_api_host:"https://widgets.entail.ai",campaigns_api_host:"https://widgets.entail.ai",autocapture:!0,rageclick:!0,lazyload:!0,widgets:!0,popups:!0,campaigns:!0,request_headers:{},token:"",disable_decide:!1,capture_pageview:!0,save_referrer:!0,store_google:!0,api_transport:"XHR",persistence:"localStorage+cookie",custom_campaign_params:[],persistence_name:"",disable_scroll_properties:!1,disable_persistence:!1,mask_all_element_attributes:!1,disable_compression:!1,mask_all_text:!1,preview_mode:!1,cookie_expiration:365,secure_cookie:"https:"===(null===(n=window)||void 0===n||null===(n=n.location)||void 0===n?void 0:n.protocol),cross_subdomain_cookie:(r=null===(i=document)||void 0===i?void 0:i.location,o=null==r?void 0:r.hostname,!!E(o)&&"herokuapp.com"!==o.split(".").slice(-2).join(".")),feature_flag_request_timeout_ms:3e3,on_request_error:function(e){var t="Bad HTTP status: "+e.statusCode+" "+e.text;U.error(t)},loaded:Si},this.__request_queue=[],this.scrollManager=new oi(this),this.pageViewManager=new ii(this)}),[{key:"_dom_loaded",value:function(){var e,t=this;U.info("DOM loaded enqueue=".concat(ki,", queue=").concat(null===(e=this.__request_queue)||void 0===e?void 0:e.length)),this.has_opted_out_capturing()||Y(this.__request_queue||[],(function(e){return t._send_retriable_request(e)})),this.__request_queue=[]}},{key:"_init",value:function(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(U.info("_init_",e,this.config,i),S(e)||function(e){return E(e)&&0===e.trim().length}(e))return U.critical("EntailInsights was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to entailInsights.init()"),this;if(this.__loaded)return U.warn("You have already initialized EntailInsights! Re-initializing is a no-op"),this;this.__loaded=!0,U.info("_init_","loaded");var o="true"===(null===(n=document)||void 0===n||null===(n=n.head)||void 0===n||null===(n=n.querySelector('meta[name="entail-campaign-preview"]'))||void 0===n?void 0:n.getAttribute("content"))||i.preview_mode||!1;return o&&U.warn("Running in preview mode"),this.config=t(t(t({},this.config),i),{},{preview_mode:o},{name:r,token:e,request_headers:t(t({},this.config.request_headers),{},{"X-Access-Token":e})}),U.info("Merged config object",this.config),this.persistence=new cn(this.config),this.sessionManager=new ln(this.config,this.persistence),this.compression=this.config.disable_compression?void 0:Gn.Base64,this.autocapture=new Ue(this),this.autocapture.startIfEnabled(),this.widgets=new _e(this),this.widgets.startIfEnabled(),this.popups=new yi(this),this.popups.startIfEnabled(),this.campaigns=new bi(this),this.campaigns.startIfEnabled(),this._loaded(),this}},{key:"has_opted_out_capturing",value:function(e){return!1}},{key:"_trackPageView",value:function(){var e;U.info("_loaded page view"),this.capture("$pageview",{title:null===(e=document)||void 0===e?void 0:e.title},{send_instantly:!0})}},{key:"_afterDecideResponse",value:function(e){var t,n,i,r;U.info("decide response: ",e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=K(e.supportedCompression,Gn.GZipJS)?Gn.GZipJS:K(e.supportedCompression,Gn.Base64)?Gn.Base64:void 0),null===(t=this.widgets)||void 0===t||t.afterDecideResponse(e),null===(n=this.popups)||void 0===n||n.afterDecideResponse(e),null===(i=this.autocapture)||void 0===i||i.afterDecideResponse(e),null===(r=this.campaigns)||void 0===r||r.afterDecideResponse(e)}},{key:"_loaded",value:function(){var e=this;U.info("loaded");try{this.config.loaded(this)}catch(e){U.critical("`loaded` function failed",e)}this.urlChangeHandler=new ai,this.config.capture_pageview&&document&&(window.addEventListener("entail_on_locationchange",(function(){U.info("entail_on_locationchange"),e._trackPageView()})),this._trackPageView()),this.config.disable_decide||new wi(this).call()}},{key:"_send_request",value:function(e){var n=this;this.__loaded&&(ki?this.__request_queue.push(e):(e.transport=e.transport||this.config.api_transport,e.url=Vn(e.url,{ip:1}),e.headers=this.config.request_headers,e.compression="best-available"===e.compression?this.compression:e.compression,function(e){var n=t({},e);n.timeout=n.timeout||6e4,n.url=Vn(n.url,{_:(new Date).getTime().toString(),ver:D.LIB_VERSION,compression:n.compression}),"sendBeacon"===n.transport&&null!=M&&M.sendBeacon?ti(n):"fetch"===n.transport&&z?ei(n):H||!R?Qn(n):ni(n)}(t(t({},e),{},{callback:function(t){var i,r,o;t.statusCode>=400&&(null===(r=(o=n.config).on_request_error)||void 0===r||r.call(o,t));null===(i=e.callback)||void 0===i||i.call(e,t)}}))))}},{key:"_send_retriable_request",value:function(e){this._send_request(e)}},{key:"capture",value:function(e,t,n){if(U.info("capture",e,t,n),!this.__loaded)return U.uninitializedWarning("entailInsights.capture");if(!S(e)&&E(e)){if(!this.config.preview_mode){var i,r,o,a;if(this.config.store_google)null===(i=this.persistence)||void 0===i||i.update_campaign_params(),null===(r=this.persistence)||void 0===r||r.set_initial_campaign_params();if(this.config.save_referrer)null===(o=this.persistence)||void 0===o||o.update_referrer_info(),null===(a=this.persistence)||void 0===a||a.set_initial_referrer_info();var s=this.getDefaultPayload(e),c={uuid:me(),event:e,properties:V(s,t||{})};(c=ee(c,null)).timestamp=(null==n?void 0:n.timestamp)||new Date,S(null==n?void 0:n.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=new Date),U.info("%cNew Event: %s","background: #222; color: #bada55",JSON.stringify(c,void 0,4));var l={method:"POST",url:"".concat(this.config.api_host,"/c"),data:c,compression:"best-available",batchKey:null==n?void 0:n._batchKey};return this._send_retriable_request(l),c}U.info("entailInsights.capture event: preview mode - return")}else U.error("No event name provided to entailInsights.capture")}},{key:"get_property",value:function(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"showPopup",value:function(e){var t;U.info("showPopup",e),null===(t=this.popups)||void 0===t||t.showPopup(e)}},{key:"trackEvent",value:function(e,t){this.capture(e,t)}},{key:"_execute_array",value:function(e){var t,n=this,i=[],r=[],o=[];Y(e,(function(e){e&&(t=e[0],y(t)?o.push(e):w(e)?e.call(n):y(e)&&"alias"===t?i.push(e):y(e)&&(-1!==t.indexOf("capture")||-1!==t.indexOf("trackEvent"))&&w(n[t])?o.push(e):r.push(e))}));var a=function(e,t){Y(e,(function(e){if(y(e[0])){var n=t;J(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(i,this),a(r,this),a(o,this)}}])}();!function(){U.info("init_from_snippet - assignableWindow",F);var e=xi[Ei]=new Pi,t=F.entailInsights;U.info("init_from_snippet",t),t&&J(t._i,(function(n){if(U.info("init_from_snippet",n),n&&y(n)){var i=e.init(n[0],n[1],n[2]),r=t[n[2]]||t;i&&i._execute_array(r)}})),F.entailInsights=e,function(){var e;function t(){t.done||(t.done=!0,J(xi,(function(e){e._dom_loaded()})))}null!==(e=document)&&void 0!==e&&e.addEventListener&&("complete"===document.readyState?t():document.addEventListener("DOMContentLoaded",t,!1)),window&&ne(window,"load",t,!0)}()}()}(); //# sourceMappingURL=entail.js.map